'use strict';
var router = require('express').Router();

var signature = require('../wx/signature');
var wechat_cfg = require('../wx/wechat.cfg');

router.get('/index', function(req, res, next) {
	//var url = req.protocol + '://' + req.host + req.path;
	var url = req.protocol + '://' + req.host + req.originalUrl; //获取当前url
	signature.sign(url, function(signatureMap) {
		signatureMap.appId = wechat_cfg.appid;
		res.render('wx', signatureMap);
	});
});

module.exports = router;